<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<script type="text/javascript">
		//数组去重	
		var arr = [1, 2, 3, 3, 4, 4, 5, 5, 6, 1, 9, 3, 25, 4];
		Array.prototype.unique2 = function() {
			var n = [];
			for(var i = 0; i < this.length; i++) {
				if(n.indexOf(this[i]) == -1) n.push(this[i]);
			}
			return n;
		}
		var newArr2 = arr.unique2(arr);
		console.log(newArr2);

		//数组去重
		function fun2(arr) {
			var n = [arr[0]];
			for(var i = 1; i < arr.length; i++) {
				if(arr.indexOf(arr[i]) == i) {
					n.push(arr[i])
				}

			}
			return n;
		}
		console.log(fun2(arr));
		
		
	//数组排序
		function fun3(arr) {
			var num = 0;
			for(var i = 0; i < arr.length - 1; i++) {
				for(var j = 0; j < arr.length - 1 - i; j++) {
					if(arr[j] > arr[j + 1]) {
						num = arr[j];
						arr[j] = arr[j + 1];
						arr[j + 1] = num
					}
				}
			}
			return arr
		}
	    console.log(arr);
		
		
	//数组排序
		for(var i=0;i<arr.length;i++){
				for(var j=i;j<arr.length;j++){
					if (arr[i]>arr[j]) {
					  var max=arr[i];
						arr[i]=arr[j];
						arr[j]=max;
					}

				}
			}
			
			console.log(arr)
	</script>

	<body>

	</body>

</html>